﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Koopakiller.Numerics.Test
{
    [TestClass()]
    public class VectorTest
    {
        #region == !=
        [TestMethod]
        public void TestEqual1()
        {
            Vector v1 = new Vector(1, 2, 3);
            Vector v2 = new Vector(1, 2, 3);
            Assert.AreEqual(true, v1 == v2);
        }
        [TestMethod]
        public void TestNotEqual1()
        {
            Vector v1 = new Vector(1, 2, 3);
            Vector v2 = new Vector(1, 2, 3);
            Assert.AreEqual(false, v1 != v2);
        }
        [TestMethod]
        public void TestEqual2()
        {
            Vector v1 = new Vector(1, -5, 3);
            Vector v2 = new Vector(1, 2, 3);
            Assert.AreEqual(false, v1 == v2);
        }
        [TestMethod]
        public void TestNotEqual2()
        {
            Vector v1 = new Vector(1, -5, 3);
            Vector v2 = new Vector(1, 2, 3);
            Assert.AreEqual(true, v1 != v2);
        }
        [TestMethod]
        public void TestEqual3()
        {
            Vector v1 = new Vector(1, 2, 3);
            Vector v2 = new Vector(1, -5, 3);
            Assert.AreEqual(false, v1 == v2);
        }
        [TestMethod]
        public void TestNotEqual3()
        {
            Vector v1 = new Vector(1, 2, 3);
            Vector v2 = new Vector(1, -5, 3);
            Assert.AreEqual(true, v1 != v2);
        }
        #endregion

        #region Add

        [TestMethod(), TestCategory("Koopakiller.Numerics.Vector")]
        public void TestAdd1()
        {
            Vector v1 = new Vector(1, 2, 3);
            Vector v2 = new Vector(1, 2, 3);
            Assert.AreEqual(new Vector(2, 4, 6), v1 + v2);
        }
        [TestMethod(), TestCategory("Koopakiller.Numerics.Vector")]
        public void TestAdd2()
        {
            Vector v1 = new Vector(1, -5, 3);
            Vector v2 = new Vector(1, 2, 3);
            Assert.AreEqual(new Vector(2, -3, 6), v1 + v2);
        }
        [TestMethod(), TestCategory("Koopakiller.Numerics.Vector")]
        public void TestAdd3()
        {
            Vector v1 = new Vector(-1, -2, -3);
            Vector v2 = new Vector(1, 2, 3);
            Assert.AreEqual(new Vector(0, 0, 0), v1 + v2);
        }

        #endregion

        #region Subtract

        [TestMethod(), TestCategory("Koopakiller.Numerics.Vector")]
        public void TestSubtract1()
        {
            Vector v1 = new Vector(1, 2, 3);
            Vector v2 = new Vector(1, 2, 3);
            Assert.AreEqual(new Vector(0, 0, 0), v1 - v2);
        }
        [TestMethod(), TestCategory("Koopakiller.Numerics.Vector")]
        public void TestSubtract2()
        {
            Vector v1 = new Vector(1, -5, 3);
            Vector v2 = new Vector(1, 2, 3);
            Assert.AreEqual(new Vector(0, -7, 0), v1 - v2);
        }
        [TestMethod(), TestCategory("Koopakiller.Numerics.Vector")]
        public void TestSubtract3()
        {
            Vector v1 = new Vector(-1, -2, -3);
            Vector v2 = new Vector(-2, -4, -6);
            Assert.AreEqual(new Vector(1, 2, 3), v1 - v2);
        }

        #endregion

        #region Multiply

        [TestMethod(), TestCategory("Koopakiller.Numerics.Vector")]
        public void TestMultiply1()
        {
            Vector v1 = new Vector(1, 2, 3);
            Vector v2 = new Vector(1, 2, 3);
            Assert.AreEqual(new Vector(1, 4, 9), v1 * v2);
        }
        [TestMethod(), TestCategory("Koopakiller.Numerics.Vector")]
        public void TestMultiply2()
        {
            Vector v1 = new Vector(1, -5, 3);
            Vector v2 = new Vector(1, 2, 3);
            Assert.AreEqual(new Vector(1, -10, 9), v1 * v2);
        }
        [TestMethod(), TestCategory("Koopakiller.Numerics.Vector")]
        public void TestMultiply3()
        {
            Vector v1 = new Vector(-1, -2, -3);
            Vector v2 = new Vector(1, 2, 3);
            Assert.AreEqual(new Vector(-1, -4, -9), v1 * v2);
        }

        #endregion

        #region Multiply (Scalar)

        [TestMethod(), TestCategory("Koopakiller.Numerics.Vector")]
        public void TestMultiplyScalar1()
        {
            Vector v1 = new Vector(1, 2, 3);
            double x = 3;
            Assert.AreEqual(new Vector(3, 6, 9), v1 * x);
        }
        [TestMethod(), TestCategory("Koopakiller.Numerics.Vector")]
        public void TestMultiplyScalar2()
        {
            Vector v1 = new Vector(1, 2, 3);
            double x = 2;
            Assert.AreEqual(new Vector(2, 4, 6), v1 * x);
        }
        [TestMethod(), TestCategory("Koopakiller.Numerics.Vector")]
        public void TestMultiplyScalar3()
        {
            Vector v1 = new Vector(1, 2, 3);
            double x = -2;
            Assert.AreEqual(new Vector(-2, -4, -6), v1 * x);
        }

        [TestMethod(), TestCategory("Koopakiller.Numerics.Vector")]
        public void TestMultiplyScalar4()
        {
            Vector v1 = new Vector(-1, -2, -3);
            double x = 3;
            Assert.AreEqual(new Vector(-3, -6, -9), x * v1);
        }
        [TestMethod(), TestCategory("Koopakiller.Numerics.Vector")]
        public void TestMultiplyScalar5()
        {
            Vector v1 = new Vector(-1, -2, -3);
            double x = 2;
            Assert.AreEqual(new Vector(-2, -4, -6), x * v1);
        }
        [TestMethod(), TestCategory("Koopakiller.Numerics.Vector")]
        public void TestMultiplyScalar6()
        {
            Vector v1 = new Vector(-1, -2, -3);
            double x = -3;
            Assert.AreEqual(new Vector(3, 6, 9), x * v1);
        }

        #endregion

        #region Pow

        [TestMethod(), TestCategory("Koopakiller.Numerics.Vector")]
        public void TestPow1()
        {
            Vector v1 = new Vector(1, 2, 3);
            double x = 3;
            Assert.AreEqual(new Vector(1D, 8D, 27D), Vector.Pow(v1, x));
        }
        [TestMethod(), TestCategory("Koopakiller.Numerics.Vector")]
        public void TestPow2()
        {
            Vector v1 = new Vector(1, 2, 3);
            double x = 2;
            Assert.AreEqual(new Vector(1D, 4D, 9D), Vector.Pow(v1, x));
        }
        [TestMethod(), TestCategory("Koopakiller.Numerics.Vector")]
        public void TestPow3()
        {
            Vector v1 = new Vector(1, 2, 3);
            double x = -2;
            Assert.AreEqual(new Vector(1D, 1D / 4D, 1D / 9D), Vector.Pow(v1, x));
        }

        [TestMethod(), TestCategory("Koopakiller.Numerics.Vector")]
        public void TestPow4()
        {
            Vector v1 = new Vector(-1, -2, -3);
            double x = 3;
            Assert.AreEqual(new Vector(-1D, -8D, -27D), Vector.Pow(v1, x));
        }
        [TestMethod(), TestCategory("Koopakiller.Numerics.Vector")]
        public void TestPow5()
        {
            Vector v1 = new Vector(-1, -2, -3);
            double x = 2;
            Assert.AreEqual(new Vector(1D, 4D, 9D), Vector.Pow(v1, x));
        }
        [TestMethod(), TestCategory("Koopakiller.Numerics.Vector")]
        public void TestPow6()
        {
            Vector v1 = new Vector(-1, -2, -3);
            double x = -3;
            Assert.AreEqual(new Vector(-1D, -1D / 8D, -1D / 27D), Vector.Pow(v1, x));
        }

        #endregion
    }
}
